package com.ruibang.glass.produce.service.impl;

import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruibang.glass.produce.entity.DefectSampleItemDetail;
import com.ruibang.glass.produce.mapper.DefectSampleItemDetailMapper;
import com.ruibang.glass.produce.service.DefectSampleItemDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: songJinKang
 * @CreateTime: 2024-05-16  15:41
 * @Description: TODO
 * @Version: 1.0
 */
@Slf4j
@Service
public class DefectSampleItemDetailServiceImpl extends ServiceImpl<DefectSampleItemDetailMapper, DefectSampleItemDetail> implements DefectSampleItemDetailService {
    @Override
    public void deleteBySampleItemId(List<String> sampleItemIds) {
        lambdaUpdate().in(DefectSampleItemDetail::getSampleItemId, sampleItemIds).remove();
    }

    @Override
    public void removeBySampleId(List<String> ids) {
        if (CollectionUtils.isNotEmpty(ids)) {
            lambdaUpdate().in(DefectSampleItemDetail::getSampleItemId, ids).remove();
        }
    }

    @Override
    public List<DefectSampleItemDetail> getBySampleItemIds(List<String> itemIds) {
        return lambdaQuery().in(DefectSampleItemDetail::getSampleItemId, itemIds).list();
    }
}
